﻿using System;
using System.Web;
using Kwd.Summary.Models;
using Orchard;

namespace Kwd.Summary.Services
{
  public interface ISummaryStrategy : IDependency
  {
    HtmlString GenerateSummary(HtmlString defaultSummary, SummaryPart contentItem);
  }

  public class GenerateSummaryException : ApplicationException
  {
    public GenerateSummaryException(ISummaryStrategy strategy, Exception innerEx, string fmtMessage, params object[] args)
      :base(String.Format(fmtMessage, args), innerEx)
    { }

    public ISummaryStrategy TargetStrategy { get; private set; }

    public override string Message{ 
      get {
        return String.Format("{0} : {1}", TargetStrategy.GetType().Name, base.Message);
      }
    }
  }
}
